using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Barrage.Global;

namespace Barrage.GUI.Elements
{
    /// <summary>
    /// Represents a text rendered on a GUI Layout
    /// </summary>
    public class GUIText : GUIElement
    {
        const string XML_TEXT_ATTRIBUTE = "text";
        
        string text;
        /// <summary>
        /// Text to be rendered
        /// </summary>
        public virtual string Text { get { return text; } set { text = value; } }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="layout">Layout that will hold this item</param>
        /// <param name="template">Template that will be used to render this item</param>
        /// <param name="xn">Xml Node that holds attribute values of this item</param>
        public GUIText(GUILayout layout, string template, XmlNode xn)
            : base(layout, template, xn)
        {
            text = Language.LanguageManager.Texts[XmlHelper.GetXMLAttribute(xn, XML_TEXT_ATTRIBUTE)];
        }
    }
}
